package acwing.链表;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/11/12
 */
public class DoubleLink {

    private static final int N = 100010;
    private static int[] e = new int[N], l = new int[N], r = new int[N];
    private static int head, tail, idx;

    public static void init() {
        // 0表示左端点 1表示右端点
        r[0] = 1;
        l[1] = 0;
        idx = 2;
    }
    // 在k的右边插入x
    public static void add(int k, int x) {
        e[idx] = x;
        r[idx] = r[k];
        l[idx] = k;

        l[r[k]] = idx;
        r[k] = idx;

    }
    // 删除第k个点
    public static void remove(int k) {

        r[l[k]] = r[k];
        l[r[k]] = l[k];
    }
}
